package OS

import (
	"bytes"
	"os/exec"
)

func execCmd(cmd *exec.Cmd) (*bytes.Buffer, error) {
	// 创建buffer来接收输出
	var out bytes.Buffer
	cmd.Stdout = &out

	// 运行命令
	err := cmd.Run()
	if err != nil {
		return nil, err
	}

	return &out, nil
}
